<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>RemoteJava Task</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
</head>

<body>

<h2><a name="java">RemoteJava</a></h2>
<h3>Description</h3>
<p>Executes a Java class on the remote host or hosts. </p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">classname</td>
    <td valign="top">the Java class to execute.</td>
    <td align="center" valign="top">Either jar or classname</td>
  </tr>
  <tr>
    <td valign="top">jar</td>
    <td valign="top">the location of the jar file to execute (must have a
    Main-Class entry in the manifest). Fork must be set to true if this option is selected.</td>
    <td align="center" valign="top">Either jar or classname</td>
  </tr>
  <tr>
    <td valign="top">classpath</td>
    <td valign="top">the classpath to use.</td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">classpathref</td>
    <td valign="top">the classpath to use, given as <a
      href="../using.html#references">reference</a> to a PATH defined elsewhere.</td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">jvm</td>
    <td valign="top">the command used to invoke the Java Virtual Machine,
      default is 'java'.  The command is resolved by java.lang.Runtime.exec().
      Ignored if fork is disabled.
    </td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">failonerror</td>
    <td valign="top">Stop the buildprocess if the command exits with a
      returncode other than 0. Default is "false" (see <a href="#failonerror">note</a>)</td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">newenvironment</td>
    <td valign="top">Do not propagate old environment when new
      environment variables are specified. Default is &quot;false&quot;
      (ignored if fork is disabled).</td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">timeout</td>
    <td valign="top">Stop the command if it doesn't finish within the specified time (given in milliseconds).</td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">hostref</td>
    <td valign="top">reference a remote host.if hostref or hostsetref both not specified, the command will execute locally </td>
    <td valign="top" align="center">NO</td>
  </tr>
  <tr>
    <td valign="top">hostsetref</td>
    <td valign="top">reference remote hosts. if hostref or hostsetref both not specified, the command will execute locally </td>
    <td valign="top" align="center">NO</td>
  </tr>
  <tr>
    <td valign="top">dir</td>
    <td valign="top">the directory name on the remote host, if it is not an absolute dir, the host's base dir will be instered before this dir. </td>
    <td valign="top" align="center">YES</td>
  </tr>
  <tr>
    <td valign="top">blocking</td>
    <td valign="top">if the process is blocking, the process will be stored in a process repository. you can use the <strong><a href="shutdownjava.html">shutdownjava</a></strong> task to shutdown the blocking process. </td>
    <td align="center" valign="top">NO</td>
  </tr>
  <tr>
    <td valign="top">duplicate</td>
    <td valign="top">the number of the processes. it will run the process in parallel. the number must not exceed the <strong>highwatermark</strong> the host.</td>
    <td align="center" valign="top">No, default is <i>1</i></td>
  </tr>
  <tr>
    <td valign="top">share</td>
    <td valign="top">if hostset is used in the task, <strong>share</strong> means that the number of the processes specified by the <strong>duplicate</strong> will be shared among the hosts in the hostset. The sum of the <strong>highwatermark</strong> for the hostset must not exceed the <strong>duplicate</strong> number. If truns off, means that we will execute <strong>duplicate</strong> number of the process on each host in the hostset.</td>
    <td align="center" valign="top">No, default is <i>false</i></td>
  </tr>
  <tr>
    <td valign="top">transmit</td>
    <td valign="top">whether or not transmit the command to the remote host, default value is YES, if set to NO, just print the command in standard output. </td>
    <td align="center" valign="top">NO</td>
  </tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>arg and jvmarg</h4>
<p>Use nested <code>&lt;arg&gt;</code> and <code>&lt;jvmarg&gt;</code>
elements to specify arguments for the Java class and the forked VM respectively.
See <a href="../using.html#arg">Command line arguments</a>.</p>
<h4>sysproperty</h4>
<p>Use nested <code>&lt;sysproperty&gt;</code>
elements to specify system properties required by the class.
These properties will be made available to the VM during the execution
of the class (either ANT's VM or the forked VM). The attributes
for this element are the same as for <a href="remoteexec.html#env">environment
variables</a>.</p>

<h4>syspropertyset</h4>

<p>You can specify a set of properties to be used as system properties
with <a href="../CoreTypes/propertyset.html">syspropertyset</a>s.</p>

<p><em>since Ant 1.6</em>.</p>

<h4>classpath</h4>
<p><code>Java</code>'s <i>classpath</i> attribute is a <a
href="../using.html#path">PATH like structure</a> and can also be set via a nested
<i>classpath</i> element.</p>

<h4>env</h4>

<p>It is possible to specify environment variables to pass to the
forked VM via nested <i>env</i> elements. See the description in the
section about <a href="remoteexec.html">remoteexec</a> </p>
<p>Settings will be ignored if fork is disabled.</p>
<h4><a href="../types/expect.html">expect</a></h4>
<p>check the output of the process, the output could be stardard output or standard error or a generated file. </p>
<h4>Examples</h4>
<pre>  &lt;remotejava dir=&quot;${resouces.dir}&quot; classname=&quot;Echo&quot; blocking=&quot;off&quot; hostref=&quot;greatwall&quot;&gt;
     &lt;arg line=&quot;abc&quot;/&gt;<br>     &lt;classpath path=&quot;${resouces.dir}&quot;/&gt;<br>  &lt;/remotejava&gt;</pre>
Run a class on the <strong>greatwall</strong> with  the specified classpath and arguments.
<pre>  &lt;remotejava dir=&quot;${resouces.dir}&quot; classname=&quot;Echo&quot; blocking=&quot;off&quot; hostref=&quot;greatwall&quot;&gt;
     &lt;arg line=&quot;abc&quot;/&gt;<br>     &lt;classpath path=&quot;${resouces.dir}&quot;/&gt;
     &lt;expect stream=&quot;out&quot;&gt; abc &lt;/expect&gt;<br>  &lt;/remotejava&gt;
</pre>
<p>Run a class on the <strong>greatwall</strong> with the specified classpath and arguments , and check the standard output to see if it is the 'abc'. </p>
<p><strong>Note</strong>: you can not specify the (highly deprecated) MSJVM, "jview.exe" as the
  JVM, as it takes different parameters for other JVMs,
  That JVM can be started from &lt;exec&gt; if required. </p>
<hr>
<p align="center">Copyright &copy; 2005 Dant Organization. All rights Reserved.</p>

</body>
</html>

